Skip to content

Add fallthrough switch statements and expressions - #19

Merged
bytetroll merged 2 commits into
codex/matrix-annotationsfrom
codex/fallthrough-switch
Oct 29, 2026
Merged

bytetroll merged 2 commits into
codex/matrix-annotationsfrom
codex/fallthrough-switch

Conversation

@bytetroll

Copy link
Copy Markdown
Contributor

Ny and Matrix now provide switch statements and expressions with C++-style fallthrough. The selector evaluates once, dispatch enters the matching case (or a default in any position), and execution continues through subsequent case bodies until an explicit exit. Ny yields values with break value; Matrix uses stop switching with value. Existing match/consider behavior is unchanged.

The shared compiler checks case identity, result types, lexical scopes, ownership and exit targets. Native and VM lowering preserve cleanup when yielding or returning from nested expressions. This also fixes forward/dotted enum resolution, aggregate construction interrupted by a return, and callable control-flow scope isolation. Unsafe loop exits across an unfinished value switch are rejected with a diagnostic; the initial label profile supports integers, booleans, text, Ny characters and wholly payload-free enums.

The change includes language-server indexing/completion, VS Code highlighting/snippets, the language reference, NIL-0021 and the next-version findings log. This PR is stacked on #18.

Validation:

  • Release build with LLVM 21 enabled.
  • 182 switch contract checks, including six execution routes for both languages, rejection/output-preservation tests, analyzer checks, and text/binary debugger sessions.
  • Complete CTest suite plus the final 37-test regression rerun: 513 passing tests and one optional PostgreSQL integration skip (514 entries).
  • VS Code extension: 117 tests passed, including TypeScript compilation.

Preserve switch and NILData findings while propagating the current master integration through the stacked pull request. TypeScript checking and all 124 extension unit tests pass.
@bytetroll
bytetroll merged commit 01a9b74 into codex/matrix-annotations Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant